﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DCT.CodeBox.BMS.Code.Datas.Interfaces;

namespace DCT.CodeBox.BMS.Code.Datas.Implements.SQLites
{
    public class RoleDataSQLite : BaseDataAccessSQLite, IRoleData
    {
        public DataResult Insert(DataModels.RoleDataModel data, out int id)
        {
            id = -1;
            DataResult dataResult = DataResult.Unknown;

            string insertSql = "INSERT INTO [{0}] "
                + "([NAME],[REMARK],[ISADMIN],[STATUS],[CREATE_DATETIME]) "
                + "VALUES (@name, @remark, @isadmin, @status, @createtime)";
            string insertPermission = "INSERT INTO [{0}] "
                + "([ROLE_ID,[PERMISSION_NAME],[CREATE_DATETIME]])"
                + "VALUES (@roleid, @pname, @createtime)";

            //todo 
            //1、用事务；2、异常处理
            //using(IDataAccessTransaction trans = CreateTrans())
            //{
            //    IDataAccessCommand cmdInsert = trans.CreateCommand(insertSql);

            //}

            return dataResult;
        }

        public DataResult Update(DataModels.RoleDataModel data)
        {
            throw new NotImplementedException();
        }

        public DataResult Delete(int id)
        {
            throw new NotImplementedException();
        }

        public DataResult RealDelete(int id)
        {
            throw new NotImplementedException();
        }

        public DataModels.RoleDataModel QueryOne(int id)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<DataModels.RoleDataModel> QueryAll(QueryInfo queryInfo)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<DataModels.RoleDataModel> QueryPager(PagerInfo pageInfo)
        {
            throw new NotImplementedException();
        }
    }
}
